$(function () {
    topage(0);
});
function topage(page) {
    var token = $("#token").val();
    if (isempty(token)) {
        location.href = "/except/login.jsp";
        return;
    } else {
        var jsonstr = "{token:" + token + "}";
        var url = "/except/usercontroller/inviteinfo.action";
        $.ajax({
            url: url,
            type: 'post',
            dataType: "json",
            data: {
                "json": jsonstr,
                page: page
            },
            async: false,
            success: function (data) {
                var code = data.code;
                var message = data.message;
                var inviteinfo = "";
                if (code == 20000) {
                    var datas = data.data;
                    $(datas).each(function () {
                        inviteinfo += '<div class="item">'+
                            '<div class="all">'+
                            '<span  class="textred">'+this.nickname+'</span>'+
                            '</div>'+
                            '<div class="all">'+
                            '<span  class="textred">'+this.indentmoney+'</span>'+
                            '</div>'+
                            '<div class="all">'+
                            '<span  class="textred">'+this.percentage+'</span>'+
                            '</div>'+
                            '</div>';
                    });
                    remove_advertising()
                } else if(code == 20013){
                    if (page == 0){
                        $("#not_data").show();
                    }
                } else if (code == 10001 || code == 10002) {
                    location.href = "/except/login.jsp";
                } else {
                    $("#hintbg").show();
                    $("#hint_message").html(message);
                }
                if(page == 0)
                    $("#invite").empty();
                $("#invite").append(inviteinfo);
            }
        });
    }
}